//
//  UIButton+Extention.swift
//  WeiboX
//
//  Created by admin on 05/12/2016.
//  Copyright © 2016 iOS_Objective-C. All rights reserved.
//

import UIKit

extension UIButton {
//	private lazy var btn: UIButton = {
//		let btn = UIButton()
//		btn.setTitle("转发", for: .normal)
//		btn.setImage(UIImage.init(named: "timeline_icon_retweet"), for: .normal)
//		btn.titleLabel?.font = UIFont.systemFont(ofSize: 14)
//		btn.titleLabel?.textColor = UIColor.gray
//		return btn
//	}()
//		convenienceinit init(title: String?, imgName: String?, txtSize: CGFloat?, txtColor: UIColor?) {
//			
//		}
	convenience init(title: String? = nil, imgName: String? = nil, backgroundImgName: String? = nil, highlightedBgImgName: String? = nil, fontSize: CGFloat? = nil, fontColor: UIColor? = nil) {
		self.init()
		if let btnTitle = title {
			self.setTitle(btnTitle, for: .normal)
		}
		if let imageName = imgName {
			self.setImage(UIImage.init(named: imageName), for: .normal)
		}
		if let backgroundImageName = backgroundImgName {
			self.setBackgroundImage(UIImage.init(named: backgroundImageName), for: .normal)
//			self.setBackgroundImage(UIImage.init(named: highlightedBgImgName!), for: .highlighted)
		}
		if let size = fontSize {
			self.titleLabel?.font = UIFont.systemFont(ofSize: size)
		}
		if let color = fontColor {
			self.setTitleColor(color, for: .normal)
		}
	}
}
